import axios from "./config"; //引入模块
//登录接口
export const login = (username, password) =>
  axios({
    url: "/users/login",
    method: "post",
    data: {
      username,
      password
    }
  });

//获取登入的日志
export const getLoginLog = () => axios.get("/getloginlog");

//获取用户的菜单
export const getMenuList = () => axios.get("/permission/getMenuList");

//获取验证码
export const getCaptcha = () => axios.get("/users/getCaptcha");
//刷新验证码
export const refreshCaptcha = () => axios.get("/users/refreshCaptcha");
//校验验证码
export const verifyCaptcha = captcha =>
  axios.get(`/users/verifyCaptcha?captcha=${captcha}`);
// 获取学员信息
export const getStuList = (params = {}) => {
  console.log(params)
  return axios({
    url: '/students/getstulist',
    params
  })
}
// 增加学员信息
export const addStuDetail = (stuDetail) => axios({
  url: '/students/addstu',
  method: 'post',
  data: stuDetail
})
// 删除学员
export const delStu = (sId) => axios.get(`/students/delstu?sId=${sId}`)
// 编辑学员信息
export const updateStu = (updated = {}) => axios({
  url: '/students/updatestu',
  method: 'post',
  data: updated
})
// 搜索学员
export const searchStu = (params) => {
  return axios(
    {
      url: '/students/searchstu',
      params
    }
  )
}

// 获取班级 /students/getclasses
export const getClasses = () => axios.get('/students/getclasses')
